package com.ljkj.blockpay.presenter;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;

import com.kongzue.baseokhttp.HttpRequest;
import com.kongzue.baseokhttp.listener.JsonResponseListener;
import com.kongzue.baseokhttp.util.JsonBean;
import com.kongzue.baseokhttp.util.JsonList;
import com.kongzue.baseokhttp.util.JsonMap;
import com.kongzue.baseokhttp.util.Parameter;
import com.ljkj.blockpay.basedata.BasePresenter;
import com.ljkj.blockpay.basedata.BasePresenterImpl;
import com.ljkj.blockpay.basedata.BaseView;
import com.ljkj.blockpay.model.RechargeModel;
import com.ljkj.blockpay.network.ApiToCConfig;
import com.ljkj.blockpay.presenter.inter.SelectCurrencyInter;
import com.luck.picture.lib.tools.ToastUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yp on 2022/3/8
 */
public class SelectCurrencyPresenter extends BasePresenterImpl<SelectCurrencyInter.SelectCurrencyInterView> implements SelectCurrencyInter.SelectCurrencyInterPresenter {

    public SelectCurrencyPresenter(@NonNull Context context, @NonNull SelectCurrencyInter.SelectCurrencyInterView view) {
        super(context, view);
    }
    //业务场景
    @Override
    public void getNetAccuracy(Integer orderType) {
        HttpRequest.GET(getContext(), ApiToCConfig.URL_TRADE_NETWORK_ACCURACY, new Parameter().add("orderType", orderType), new JsonResponseListener() {
            @Override
            public void onResponse(JsonMap main, Exception error) {
                if (main.getInt("code") == 0){
                    JsonList data = main.getList("data");
                    getView().showNetAccuracy(data);
                }else{
                    ToastUtils.s(getContext(),main.getString("msg"));
                }
            }
        });
    }
}
